#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableRedPointRelationDao:DaoBase<TableRedPointRelation>
    {
        public override string GetFileName()
        {
            return "TableRedPointRelation.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableRedPointRelation>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableRedPointRelation model)
        {
            if (!cacheOneIndex.ContainsKey(model.upperId.ToString()))
            {
                cacheOneIndex[model.upperId.ToString()] = new List<TableRedPointRelation>();
            }
            cacheOneIndex[model.upperId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableRedPointRelation model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.redId)) UnityEngine.Debug.LogError("数据表id重复:TableRedPointRelation->id: " + model.redId);
            #endif
            cachePrimaryInt[model.redId] = model;
        }
        protected override TableRedPointRelation ParseRowData(string[] rowData)
        {
            TableRedPointRelation data = new TableRedPointRelation();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.redId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.upperId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.redName = rowData[2];
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.relatedSwitch = string.Intern(rowData[3]);
            }
            return data;
        }
    }
}
